package org.edu.modules.act.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
import org.apache.poi.xwpf.converter.core.FileImageExtractor;
import org.apache.poi.xwpf.converter.core.FileURIResolver;
import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
import org.apache.poi.xwpf.converter.xhtml.XHTMLOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.edu.common.api.vo.Result;
import org.edu.modules.act.service.TaskService;
import org.edu.modules.act.service.WordOnlineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

@Api(tags = "word在线编辑")
@RestController
@RequestMapping("/activiti/wordOnline")
@Slf4j
public class WordOnLineController {

    @Autowired
    private WordOnlineService wordOnlineService;

    @ApiOperation(value = "流程查询", notes = "流程上线模块-流程查询")
    @PostMapping(path = "/getH5")
    public Result<?> getH5(String url) throws Exception {
        Map<String, String> map = wordOnlineService.getH5(url);
        return Result.OK(map);
    }
}
